package com.bear.newsset.adapter;

import androidx.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.bear.newsset.R;
import com.bear.newsset.entity.OptEntity;
import com.bear.newsset.holder.OptionHolder;
import com.bumptech.glide.RequestManager;

import java.util.List;

public class OptionAdapter extends BaseXRecyclerViewAdapter<OptEntity> {
    public OptionAdapter(List<OptEntity> mDataList) {
        super(mDataList);
    }

    public OptionAdapter(RequestManager mGlide, List<OptEntity> mDataList) {
        super(mGlide, mDataList);
    }

    @NonNull
    @Override
    public BaseViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        return new OptionHolder(
                LayoutInflater.from(viewGroup.getContext())
                        .inflate(R.layout.item_opt, viewGroup, false)
        );
    }

    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder viewHolder, int position) {
        super.onBindViewHolder(viewHolder, position);
        OptionHolder holder = (OptionHolder) viewHolder;
        OptEntity entity = getDataList().get( position );
        holder.getImg().setImageResource( entity.getImgRes() );
        holder.getTitle().setText( entity.getTitle() );
        holder.getContent().setText( entity.getContent() );
    }

    @Override
    public int setUpResources() {
        return 0;
    }

    @Override
    public int setDownResources() {
        return 0;
    }
}
